package com.packet.service.impl;

import com.packet.mapper.FinanceCorrectTripMapper;
import com.packet.pojo.Customs;
import com.packet.pojo.Examine;
import com.packet.service.FinanceCorrectTripService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@Service
public class FinanceCorrectTripServiceImpl implements FinanceCorrectTripService {
    private  float sumMoney = 0;

    @Resource
    FinanceCorrectTripMapper financeCorrectTripMapper;


    @Override
    public List<Customs> selectDetailById(Integer id) {
        sumMoney = 0;
        List<Customs> customs = financeCorrectTripMapper.selectDetailById(id);
        for (Customs custom : customs) {
            sumMoney = sumMoney + custom.getCmoney();
        }
        return  customs;
    }

    public float countAllMoney(){
        return sumMoney;
    }

    @Override
    public boolean correctItById(Map<String, Object> map) {
        return financeCorrectTripMapper.correctItById(map);
    }

    @Override
    public boolean correctState(Map<String,Object> map){
        return financeCorrectTripMapper.correctState(map);
    }

    @Override
    public Examine getExamineByBid(Integer bid) {
        return financeCorrectTripMapper.getExamineByBid(bid);
    }
}
